<template>
  <div>
    <el-dialog :title="option.title" :visible.sync="isShow" :close-on-click-modal="false" width="80%" @open="openDialog"
      @close="closeDialog('ruleForm')">
      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" size="small">
        <el-row>
          <el-col :span="13">
            <el-form-item label="机构名称" prop="branchNO">
              <!-- <el-popover placement="bottom" width="200" trigger="click" v-model="popoverShow">
                <el-tree :data="option.treedata" :highlight-current="true" :expand-on-click-node="false" default-expand-all
                  :props="defaultProps" @node-click="getBranch">
                </el-tree>
                <el-input slot="reference" size="small" v-model="ruleForm.branchName" placeholder="请选择机构"
                  :disabled="option.title=='修改班次'"></el-input>
              </el-popover> -->
              <el-input v-model.trim="ruleForm.branchName" size="small" :disabled="option.title=='修改班次'" v-if="option.title=='修改班次'"></el-input>
              <select-tree :tree-data="option.treedata" :branch="ruleForm.branchName" @getBranchName="getBranch" v-if="option.title!='修改班次'"></select-tree>
            </el-form-item>
          </el-col>
        </el-row>
        <el-col :span="13" v-if="ruleForm.CLASSESID">
          <el-form-item label="班次编号" prop="CLASSESID">
            <el-input v-model="ruleForm.CLASSESID" disabled size="small"></el-input>
          </el-form-item>
        </el-col>
        </el-row>
        <el-row>
          <el-col :span="13">
            <el-form-item label="班次名称" prop="CLASSESNAME">
              <el-input v-model.trim="ruleForm.CLASSESNAME" size="small" placeholder="请输入班次名称"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="13">
            <el-form-item label="活动类型" prop="ACTIVITYTYPE">
              <el-select v-model="ruleForm.ACTIVITYTYPE" size="small" placeholder="请选择活动类型">
                <el-option v-for="item in actOptions" :key="item.ACTIVITYTYPE" :label="item.ACTIVITYTYPENAME"
                  :value="item.ACTIVITYTYPE"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="13">
            <el-form-item label="时长" prop="HOURS">
              <el-time-picker size="small"  @focus="ChangeTime('HOURS')" v-model="ruleForm.HOURS" format="HH:mm" value-format="HH:mm"
                style="width: 100%" placeholder="选择时长">
              </el-time-picker>
            </el-form-item>
          </el-col>
          <el-col :span="13">
            <el-form-item label="开始时间" prop="SRTTIME">
              <el-time-picker size="small" v-model="ruleForm.SRTTIME" format="HH:mm" @focus="ChangeTime('SRTTIME')"  value-format="HH:mm"
                style="width: 100%" placeholder="选择开始时间">
              </el-time-picker>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="13">
            <el-form-item label="最短间隔" prop="MININTERVAL">
              <el-time-picker size="small" v-model="ruleForm.MININTERVAL" 
                @focus="ChangeTime('MININTERVAL')"  format="HH:mm" value-format="HH:mm"
                style="width: 100%" placeholder="选择最短间隔">
              </el-time-picker>
            </el-form-item>
          </el-col>
          <el-col :span="13">
            <el-form-item label="最长间隔" prop="MAXINTERVAL">
              <el-checkbox v-model="ruleForm.checked" @change="changeChecked">无限制</el-checkbox>
              <el-time-picker size="small" v-model="ruleForm.MAXINTERVAL" 
                @focus="ChangeTime('MAXINTERVAL')" :disabled="ruleForm.checked==true"
                format="HH:mm" value-format="HH:mm" style="width: 50%" placeholder="选择最长间隔">
              </el-time-picker>
            </el-form-item>
          </el-col> -->
          <el-col :span="20">
            <el-form-item label="说明" prop="NOTES">
              <el-input size="small" type="textarea" :rows="2" v-model="ruleForm.NOTES" placeholder="请输入说明"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-collapse v-model="activeNames" style="margin-left:5%;">
              <el-collapse-item name="1">
                <template slot="title">
                  关联的班次事件<i class="header-icon el-icon-info"></i>
                </template>
                <el-table :data="ruleForm.EVENT">
                  <el-table-column label="事件编号" prop="CLASSESEVENTID" width="130"></el-table-column>
            <el-table-column label="事件名称" prop="CLASSESEVENTNAME"></el-table-column>
            <el-table-column label="活动编号" prop="ACTIVITYTYPE"></el-table-column>
            <el-table-column label="活动类型" prop="ACTIVITYTYPENAME"></el-table-column>
            <el-table-column label="时长" prop="HOURS" align="center"></el-table-column>
            <el-table-column label="开始时间类型" align="center" prop="SRTTIMETYPE" width="160">
              <template slot-scope="scope">
                <span>{{scope.row.SRTTIMETYPE === "0"?"绝对时间":(scope.row.SRTTIMETYPE === "1"?"相对于班次开始时间后":(scope.row.SRTTIMETYPE === "2"?"相对于班次结束时间前":"任意时间"))}}</span>
              </template>
            </el-table-column>
            <el-table-column label="时间" prop="SRTTIME" width="120" align="center">
              <template slot-scope="scope">
                <div>
                  {{scope.row.SRTTIME}}
                  <span v-if="scope.row.ENDTIME != ''"> -- {{scope.row.ENDTIME}}</span>
                </div>
              </template>
            </el-table-column>
            <!-- <el-table-column label="结束时间" prop="ENDTIME" width="100" align="center"></el-table-column> -->
            <el-table-column label="是否带薪" prop="ISPAID" align="center">
              <template slot-scope="scope">
                <span>{{scope.row.ISPAID === "1"?"是":"否"}}</span>
              </template>
            </el-table-column>
            <el-table-column label="最少次数" prop="MINTIMES" width="100" align="center"></el-table-column>
            <el-table-column label="最多次数" prop="MAXTIMES" width="100" align="center"></el-table-column>
            <el-table-column label="说明" prop="NOTES" width="120"></el-table-column>
                  <el-table-column label="操作" fixed="right">
                    <template slot-scope="scope">
                      <el-tooltip class="item" effect="dark" content="删除事件" placement="top">
                        <el-button type="text" style="margin-left:0px" @click="delEvent(scope.row)">
                          <i class="el-icon-delete"></i>
                        </el-button>
                      </el-tooltip>
                    </template>
                  </el-table-column>
                </el-table>
                <el-col :span="4" :offset="19" style="margin-top:10px;margin-bottom:10px;">
                  <el-button type="primary" size="mini" icon="el-icon-plus" @click="addEvent">新增关联班次事件</el-button>
                </el-col>
              </el-collapse-item>
            </el-collapse>
          </el-col>
          <el-col :span="8" :offset="16" style="margin-top:10px;">
            <el-form-item>
              <el-button type="primary" size="small" @click="submitForm('ruleForm')">保存</el-button>
              <el-button size="small" @click="resetForm('ruleForm')">重置</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-dialog>
    <!-- 关联班次事件的dialog -->
    <el-dialog title="关联班次事件" append-to-body :visible.sync="eventIsShow" :close-on-click-modal="false" width="80%"
      @open="openEventDialog">
      <el-table :data="eventData" ref="multipleTable" @selection-change="changeFun" @select="selectMemoryFn"
        @select-all="selectAll">
        <el-table-column type="selection" width="55" :selectable="checkboxInit">
        </el-table-column>
        <el-table-column label="事件编号" prop="CLASSESEVENTID" width="130"></el-table-column>
            <el-table-column label="事件名称" prop="CLASSESEVENTNAME"></el-table-column>
            <el-table-column label="活动编号" prop="ACTIVITYTYPE"></el-table-column>
            <el-table-column label="活动类型" prop="ACTIVITYTYPENAME"></el-table-column>
            <el-table-column label="时长" prop="HOURS" align="center"></el-table-column>
            <el-table-column label="开始时间类型" align="center" prop="SRTTIMETYPE" width="160">
              <template slot-scope="scope">
                <span>{{scope.row.SRTTIMETYPE === "0"?"绝对时间":(scope.row.SRTTIMETYPE === "1"?"相对于班次开始时间后":(scope.row.SRTTIMETYPE === "2"?"相对于班次结束时间前":"任意时间"))}}</span>
              </template>
            </el-table-column>
            <el-table-column label="时间" prop="SRTTIME" width="120" align="center">
              <template slot-scope="scope">
                <div>
                  {{scope.row.SRTTIME}}
                  <span v-if="scope.row.ENDTIME != ''"> -- {{scope.row.ENDTIME}}</span>
                </div>
              </template>
            </el-table-column>
            <!-- <el-table-column label="结束时间" prop="ENDTIME" width="100" align="center"></el-table-column> -->
            <el-table-column label="是否带薪" prop="ISPAID" align="center">
              <template slot-scope="scope">
                <span>{{scope.row.ISPAID === "1"?"是":"否"}}</span>
              </template>
            </el-table-column>
            <el-table-column label="最少次数" prop="MINTIMES" width="100" align="center"></el-table-column>
            <el-table-column label="最多次数" prop="MAXTIMES" width="100" align="center"></el-table-column>
            <el-table-column label="说明" prop="NOTES" width="120"></el-table-column>
      </el-table>
      <div class="box" style="text-align:right;">
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
          :current-page.sync="currentPage" :page-sizes="[5]" :page-size="pageSize" layout="prev, pager, next"
          :total="tableTotal">
        </el-pagination>
      </div>
      <el-row>
        <el-col :span="8" :offset="16" style="margin-top:10px;">
          <el-button type="primary" size="small" @click="saveEvent">保存</el-button>
          <el-button size="small" @click="cancelEvent">取消</el-button>
        </el-col>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
  import request from "@/common/utils/requestWFM";
  import Update from '@/message/wfm/scheduleDataManage/classManage/classUpdate'
  import Add from '@/message/wfm/scheduleDataManage/classManage/classAdd'
  import QueryEvent from '@/message/wfm/scheduleDataManage/classEventManage/classEventQuery'
  import ActivityQuery from '@/message/wfm/scheduleDataManage/activityManage/actQuery';
  import selectTree from "@/components/selectTree5/";

  export default {
    components: {
      selectTree
    },
    mounted() {
      this.actQuery()
      // console.log(this.option)
    },
    props: {
      option: Object,
    },
    watch: {
      'ruleForm.checked': function (val) {
        if (val == true) {
          this.ruleForm.MAXINTERVAL = '00:00'
        }
      },
      'ruleForm.MAXINTERVAL': function (val) {
        if (val == '00:00') {
          this.ruleForm.checked = true
        }
      },
      eventData(oldVal, newVal) { // 监听数据变化，然后执行分页记忆自动选中回调
        this.$nextTick(() => {
          this.selectMemoriedDataFn();
        })
      },
    },
    data() {
      return {
        defaultProps: {
          children: 'children',
          label: 'BRANCHNAME'
        },
        popoverShow: false,
        actOptions: [], //活动类型
        currentPage: 1,
        pageSize: 5,
        tableTotal: 0,
        multipleSelection: [],
        QuestionId: [], // 选中的数据QuestionId数组
        eventData: [],
        activeNames: ['1'],
        ruleForm: {
          branchNO: '',
          branchName: '',
          checked: false,
          CLASSESNAME: '',
          ACTIVITYTYPE: '',
          HOURS: '',
          SRTTIME: '',
          // MININTERVAL: '',
          // MAXINTERVAL: '',
          NOTES: '',
          CLASSESEVENTIDLIST: '',
          EVENT: []
        },
        eventIsShow: false, //关联班次事件的isShow
        rules: {
          CLASSESNAME: [{
              required: true,
              message: '请输入班次名称',
              trigger: 'blur'
            },
            // {
            //   min: 1,
            //   max: 25,
            //   message: '长度在 1 到 25 个字符',
            //   trigger: 'blur'
            // }
          ],
          ACTIVITYTYPE: [{
            required: true,
            message: '请选择活动类型',
            trigger: 'change'
          }],
          HOURS: [{
            required: true,
            message: '请输入时长',
            trigger: 'blur'
          }],
          branchNO: [{
            required: true,
            message: '请选择机构',
            trigger: 'change'
          }],
          SRTTIME: [{
            required: true,
            message: '请选择开始时间',
            trigger: 'change'
          }],
          // MININTERVAL: [{
          //   required: true,
          //   message: '请选择最短间隔',
          //   trigger: 'change'
          // }],
          // MAXINTERVAL: [{
          //   required: true,
          //   message: '请选择最长间隔',
          //   trigger: 'change'
          // }],
        },
        // pickerOptionsStart: {
        //   disabledDate: (time) => {
        //     // return time.getTime() < Date.now()
        //   }
        // },
        // pickerOptionsEnd: {
        //   disabledDate: (time) => {
        //     // return time.getTime() < Date.now()
        //   }
        // },
      }
    },
    computed: {
      isShow: {
        get() {
          return this.option.isShow;
        },
        set(value) {
          this.option.isShow = value;
        }
      }
    },
    methods: {
      // changeStart() {
      //   this.pickerOptionsEnd = Object.assign({}, this.pickerOptionsEnd, {
      //     disabledDate: (time) => {
      //       console.log(time);
      //       if (this.ruleForm.MININTERVAL) {
      //         return time.getTime() < Date.parse(this.ruleForm.MININTERVAL.slice(0, 4) + '-' + this.ruleForm.MININTERVAL
      //         .slice(4, 6) + '-' + this.ruleForm.MININTERVAL.slice(6, 8)) - 8.64e7 
      //       } else {
      //         // return time.getTime() < Date.now();
      //       }
      //     }
      //   })
      // },
      // changeEnd() {
      //   this.pickerOptionsStart = Object.assign({}, this.pickerOptionsStart, {
      //     disabledDate: (time) => {
      //       console.log(time);
      //       if (this.ruleForm.MAXINTERVAL) {
      //         return time.getTime() > Date.parse(this.ruleForm.MAXINTERVAL.slice(0, 4) + '-' + this.ruleForm.MAXINTERVAL
      //           .slice(4, 6) + '-' + this.ruleForm.MAXINTERVAL.slice(6, 8)) 
      //       } else {
      //         // return time.getTime() < Date.now();
      //       }
      //     }
      //   })
      // },
      ChangeTime(data){
        var time = '00:00';
        var that = this;
        if(data == 'HOURS'){
          if(this.ruleForm.HOURS == ''){
            this.ruleForm.HOURS = time;
          }
        }else if(data == 'SRTTIME'){
          if(this.ruleForm.SRTTIME==''){
            this.ruleForm.SRTTIME = time;
          }
        }
        // else if(data == 'MININTERVAL'){
        //   if(this.ruleForm.MININTERVAL==''){
        //     this.ruleForm.MININTERVAL = time;
        //   }
        // }else if(data == 'MAXINTERVAL'){
        //   if(this.ruleForm.MAXINTERVAL==''){
        //     this.ruleForm.MAXINTERVAL = time;
        //   }
        // }
      },
      // changeChecked(){
      //   this.$forceUpdate();
      // },
      getBranch(data) {
        this.ruleForm.branchName = data.BRANCHNAME
        this.ruleForm.branchNO = data.BRANCHNO
        this.popoverShow = false
      },
      // 活动查询
      async actQuery() {
        let resBody = new ActivityQuery()
        resBody.data.CurrPage = 1;
        resBody.data.PageRowNum = 20;
        resBody.data.ACTIVITYCATEG = '01';
        let response = await request(resBody);
        if (response.SYS_HEAD.ReturnCode == "000000") {
          this.actOptions = response.BODY.RSPSTRUCT
        } else {
          this.$message({
            type: "error",
            message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD.ReturnMessage
          })
        }
      },
      changeFun(val) {
        this.$nextTick(() => {
          let QuestionId = []
          this.multipleSelection.forEach(L => L.forEach(M => QuestionId.push(M.QuestionId)))
          this.QuestionId = QuestionId;
          // console.log(this.TipsId);
        })
      },
      selectMemoryFn(val, row) { // 设置分页记忆二位数组方法
        // 注意：val 传过来默认为数组类型 ，row 为 Object（当前选择数据对象）
        let currentArr = this.multipleSelection[this.currentPage - 1] // 当前分页对应数组
        if (!currentArr) {
          this.multipleSelection[this.currentPage - 1] = val // 不存在这个二维数组，则创建这个二位数组
        } else { // 存在
          if (val.includes(row)) { // 选中
            this.multipleSelection[this.currentPage - 1] = val
          } else { // 取消
            for (var i = 0; i < currentArr.length; i++) {
              if (currentArr[i]) {
                if (currentArr[i].CLASSESEVENTID == row.CLASSESEVENTID) {
                  delete currentArr[i];
                  break;
                }
              }
            }
            // delete currentArr[currentArr.indexOf(row)]
          }
        }
      },
      selectAll(selection) { // 全选切换方法
        if (selection.length) { // 全选
          this.multipleSelection[this.currentPage - 1] = selection
        } else { // 全不选
          this.multipleSelection[this.currentPage - 1] = []
        }
      },
      handleSizeChange(val) {
        this.pageSize = val;
        this.classEventQuery();
      },
      handleCurrentChange(val) {
        this.currentPage = val;
        this.classEventQuery();
      },
      selectMemoriedDataFn() { // 分页记忆自动选中方法
        let currentArr = this.multipleSelection[this.currentPage - 1] // 当前分页对应被选中数据
        if (currentArr && currentArr.length) { // 存在则继续执行
          let tempRowsIDs = this.eventData.map(L => L.CLASSESEVENTID) // 当前分页被选中数据的id集合
          currentArr.forEach((item, index) => { // 遍历当前分页被选中数据
            if (tempRowsIDs.includes(item.CLASSESEVENTID)) { // id匹配上，则选中
              this.$refs.multipleTable.toggleRowSelection(this.eventData[tempRowsIDs.indexOf(item.CLASSESEVENTID)])
            }
          })
        }
      },
      uniqueArr(array) {
        var n = []; //一个新的临时数组
        //遍历当前数组
        for (var i = 0; i < array.length; i++) {
          //如果当前数组的第i已经保存进了临时数组，那么跳过，
          //否则把当前项push到临时数组里面
          if (n.indexOf(array[i]) == -1) n.push(array[i]);
        }
        return n;
      },
      closeDialog(formName) {
        this.$refs[formName].resetFields();
        this.$refs[formName].clearValidate();
        this.ruleForm.CLASSESEVENTIDLIST = ''
        this.ruleForm.CLASSESID = ''
        this.ruleForm.CLASSESNAME = ''
        this.ruleForm.ACTIVITYTYPE = ''
        this.ruleForm.HOURS = ''
        this.ruleForm.SRTTIME = ''
        // this.ruleForm.MININTERVAL = ''
        // this.ruleForm.MAXINTERVAL = ''
        this.ruleForm.NOTES = ''
        this.ruleForm.EVENT = []
        this.ruleForm.branchNO = ''
        this.ruleForm.branchName = ''
        this.ruleForm.checked = false
      },
      handleSelectionChange(val) {
        this.multipleSelection = val;
        // console.log(val)
      },
      // 班次事件查询
      async classEventQuery() {
        let resBody = new QueryEvent()
        resBody.data.BRANCHNO = this.ruleForm.branchNO
        resBody.data.CurrPage = this.currentPage + "";
        resBody.data.PageRowNum = this.pageSize + "";
        let response = await request(resBody);
        if (response.SYS_HEAD.ReturnCode == "000000") {
          this.eventData = response.BODY.RSPSTRUCT
          this.tableTotal = response.BODY.TotalRowNum;
        } else {
          this.$message({
            type: "error",
            message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD.ReturnMessage
          })
        }
      },
      // 打开关联班次事件的dialog
      openEventDialog() {
        this.currentPage = 1;
        this.multipleSelection = [];
        this.classEventQuery()
      },
      addEvent() {
        this.eventIsShow = true
      },
      // 保存所选的班次事件
      saveEvent() {
        this.multipleSelection.forEach(item => {
          item.forEach(i => {
            this.ruleForm.EVENT.push(i)
          })
        })
        this.eventIsShow = false
      },
      // 取消所选的班次事件
      cancelEvent() {
        this.eventIsShow = false
      },
      delEvent(row) {
        let i
        this.ruleForm.EVENT.forEach((item, index) => {
          if (item.CLASSESEVENTID === row.CLASSESEVENTID) {
            i = index
          }
        });
        this.ruleForm.EVENT.splice(i, 1)
        // console.log(this.ruleForm.EVENT)
      },
      openDialog() {
        if (this.$refs['ruleForm'] != undefined) {
          this.$refs['ruleForm'].clearValidate();
          this.$refs['ruleForm'].resetFields();
        }
        if (this.option.title === '修改班次'){
          this.ruleForm = JSON.parse(JSON.stringify(this.option.row));
        }else{
          this.ruleForm.CLASSESEVENTIDLIST = ''
          this.ruleForm.CLASSESID = ''
          this.ruleForm.CLASSESNAME = ''
          this.ruleForm.ACTIVITYTYPE = ''
          this.ruleForm.HOURS = ''
          this.ruleForm.SRTTIME = ''
          // this.ruleForm.MININTERVAL = ''
          // this.ruleForm.MAXINTERVAL = ''
          this.ruleForm.NOTES = ''
          this.ruleForm.EVENT = []
          this.ruleForm.checked = false
        }
      },
      checkboxInit(row, index) {
        var selectId = this.ruleForm.EVENT.map(item => item.CLASSESEVENTID) // 数据的id集合
        if (selectId.includes(row.CLASSESEVENTID)) { // id匹配上，则不可选中
          return false;
        } else {
          return true;
        }
      },
      submitForm(formName) {       
        this.$refs[formName].validate(async (valid) => {
          if (valid) {
            // var c1 = Date.parse('2008-08-08 '+this.ruleForm.MININTERVAL); //'2008-08-08'这个日期随便给
            // var c2 = Date.parse('2008-08-08 '+this.ruleForm.MAXINTERVAL);
            // if(!this.ruleForm.checked){
            //   if (c1 > c2) {
            //     this.$message({
            //       type: "error",
            //       message: "最长间隔应大于等于最短间隔"
            //     })
            //     return;
            //   }
            // }
            let resBody
            if (this.option.title === '新增班次') {
              resBody = new Add()
            } else {
              resBody = new Update()
            }
            let classId = []
            this.ruleForm.EVENT.forEach(item => {
              classId.push(item.CLASSESEVENTID)
            })
            this.ruleForm.CLASSESEVENTIDLIST = classId.join(',')
            resBody.data = JSON.parse(JSON.stringify(this.ruleForm))
            resBody.data.MININTERVAL = '00:00'
            resBody.data.MAXINTERVAL = '00:00'
            resBody.data.BRANCHNO = this.ruleForm.branchNO
            let response = await request(resBody);
            if (response.SYS_HEAD.ReturnCode == "000000") {
              this.option.isShow = false
              this.$emit("ListenClass")
            } else {
              this.$message({
                type: "error",
                message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD
                  .ReturnMessage
              })
            }
            // else if(this.option.title==='修改班次'){
            //   let resBody = new Update()
            //   let classId = []
            //   this.ruleForm.EVENT.forEach(item => {
            //     classId.push(item.CLASSESEVENTID)
            //   })
            //   this.ruleForm.CLASSESEVENTIDLIST = classId.join(',')
            //   resBody.data = JSON.parse(JSON.stringify(this.ruleForm))
            //   // resBody.data.CLASSESEVENTIDLIST = classId.join(',')
            //   // resBody.data.CLASSESID = this.ruleForm.CLASSESID
            //   // resBody.data.CLASSESNAME = this.ruleForm.CLASSESNAME
            //   // resBody.data.ACTIVITYTYPE = this.ruleForm.ACTIVITYTYPE
            //   // resBody.data.HOURS = this.ruleForm.HOURS
            //   // resBody.data.SRTTIME = this.ruleForm.SRTTIME
            //   // resBody.data.MININTERVAL = this.ruleForm.MININTERVAL  
            //   // resBody.data.MAXINTERVAL = this.ruleForm.MAXINTERVAL
            //   // resBody.data.NOTES = this.ruleForm.NOTES
            //   let response = await request(resBody);
            //   if (response.SYS_HEAD.ReturnCode == "000000") {
            //     this.option.isShow = false
            //     this.$emit("ListenClass")
            //   } else {
            //     this.$message({
            //       type: "error",
            //       message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD
            //         .ReturnMessage
            //     })
            //   }
            // }
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  };

</script>

<style scoped lang="scss">

</style>
